# -*- coding: utf-8 -*-
# @Time    : 2023/11/14
# @Author  : Yangyali
#
class GameStats:
    """跟踪游戏的统计信息"""
    def __init__(self,ai_game):
        self.settings = ai_game.settings
        self.reset_stats()
        #游戏一开始处于非活跃状态
        self.game_active = False
        #从文件中读取最高分
        self.high_score = int(self.get_high_score_from_file())

    def reset_stats(self):
        """初始化在游戏运行期间可能变化的统计信息"""
        self.ships_left = self.settings.ship_limit
        self.score =0
        self.level = 1

    def get_high_score_from_file(self):
        with open('output.txt', 'r') as file:
            hight_score=file.read()
        return hight_score